import type { RowType } from '#/views/system/sysLoginLog/sysLoginLog.data';

import { requestClient } from '#/api/request';

export namespace SysLoginLogTableApi {
  export type RowTypeFetchParams = RowType;
  export interface IdFetchParams {
    id: string;
  }
  export interface ListFetchParams {
    [key: string]: any;
  }
  export interface PageListFetchParams {
    [key: string]: any;
    pageNo: number;
    pageSize: number;
  }
}

/**
 * 分页列表查询
 */
export async function sysLoginLogQueryPageListApi(
  params: SysLoginLogTableApi.PageListFetchParams,
) {
  return requestClient.get('/system/sysLoginLog/queryPageList', { params });
}

/**
 * 列表查询
 */
export async function sysLoginLogQueryListApi(
  params: SysLoginLogTableApi.ListFetchParams,
) {
  return requestClient.get('/system/sysLoginLog/queryList', { params });
}

/**
 * 通过ID查询
 * @param params
 */
export async function sysLoginLogQueryByIdApi(
  params: SysLoginLogTableApi.IdFetchParams,
) {
  return requestClient.get('/system/sysLoginLog/queryById', { params });
}

/**
 * 新增
 */
export async function sysLoginLogAddApi(
  params: SysLoginLogTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/system/sysLoginLog/add', params);
}

/**
 * 编辑
 */
export async function sysLoginLogEditApi(
  params: SysLoginLogTableApi.RowTypeFetchParams,
) {
  return requestClient.post('/system/sysLoginLog/edit', params);
}

/**
 * 删除
 * @param id 主键
 */
export async function sysLoginLogDelApi(id) {
  return requestClient.delete<boolean>(`/system/sysLoginLog/delete/${id}`);
}

/**
 * 批量删除删除
 * @param ids 主键
 */
export async function sysLoginLogDeleteBatchApi(ids) {
  return requestClient.delete<boolean>(
    `/system/sysLoginLog/deleteBatchByIds/${ids}`,
  );
}
